def ban(banplayername, bantime, why = "无原因", operator = "命令系统"):
    banTime = int(bantime)
    banStartTime = int(time.time())
    banStartTimeFormat = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(banStartTime))
    banToTime = banStartTime+banTime
    banToTimeFormat = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(banToTime))
    banRemTime = banToTime-int(time.time())
    if banRemTime > 0:
        setPlayerData("ban", banplayername, "%d+%d, %s, %s, %s" % (banStartTime, banTime, server, operator, why))
        M, S = divmod(banRemTime, 60)
        H, M = divmod(M, 60)
        D, H = divmod(H, 24)
        banRemTimeFormat = "%sDays %sHours %sMinutes %sSeconds" % (D, H, M, S)
        tellrawText("@a", "§l§4Warning§r", "§c§l%s§r§c 已被 §l%s§r§c 在服 §l%s§r§c 封禁, 已踢出\n剩余时长: §l%s§r§c\n封禁时间: §l%s§r§c\n解封时间: §l%s§r§c\n原因: §l%s§r§c" % (banplayername, operator, server, banRemTimeFormat, banStartTimeFormat, banToTimeFormat, why))
        sendcmd("/kick %s §c§l你§r§c 已被 §l%s§r§c 在服 §l%s§r§c 封禁, 已踢出\n剩余时长: §l%s§r§c\n封禁时间: §l%s§r§c\n解封时间: §l%s§r§c\n原因: §l%s§r§c" % (banplayername, operator, server, banRemTimeFormat, banStartTimeFormat, banToTimeFormat, why))
